const WebSocket = require('ws');
const { setupWSConnection } = require('y-websocket/bin/utils');

// const app = express();
// const server = http.createServer(app);
const port = 1234;

const wss = new WebSocket.WebSocketServer({ port });
wss.on('connection', (ws, req) => {
  const docName = req.url.slice(1);
  console.log("等待初始化 WS 服务...", docName);
  setupWSConnection(ws, req, { docName })
});